package com.example._web;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

public class HelloServlet2 implements Servlet {
    //service专门来处理请求和相应的
    @Override
    public void init(ServletConfig servletConfig) throws ServletException {

    }

    @Override
    public ServletConfig getServletConfig() {
        return null;
    }

    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
System.out.println("HelloServlet2被访问了！");//
//类型转换
HttpServletRequest httpServletRequestrequest = (HttpServletRequest) servletRequest;
//获取请求的方式
        String method = httpServletRequestrequest.getMethod();
        if (method.equals("Get")){

        }else if (method.equals("Post")){

        }
    }

    @Override
    public String getServletInfo() {
        return null;
    }

    @Override
    public void destroy() {

    }
}
